home *** CD-ROM | disk | FTP | other *** search
- #include <exec/exec.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <dos/dos.h>
- #include <dos/dosextens.h>
- void LastCommand(void);
- void end(void);
- char WindowName[255];
- VOID
- SendAmigaDOSCommand(UBYTE *Name);
- struct ConUnit *
- GetConUnit(struct MsgPort *ConsoleTask);
-
- struct CommandLineInterface *temp=NULL;
- #define sm sendmessage
- main(int argc,char *argv[])
- {
- Register(argv[1][0]-'0');
- temp=(struct CommandLineInterface *)Cli();
- if(temp)
- {
- sm("Yes there is a commandline interface for this door.",1);
- }
- else sm("Can't locate a commandline interface.",1);
-
- ShutDown();
- end();
- }
-
- void LastCommand(void)
- {
- }
- void end(void)
- {
- exit(0);
- }
-
- strcpy(WindowName,"CON:0/11//100/term Output Window/CLOSE/SCREEN TERM");
- struct ConUnit *
- GetConUnit(struct MsgPort *ConsoleTask)
- {
- struct InfoData *InfoData;
- struct ConUnit *ConUnit = NULL;
-
- if(!ConsoleTask)
- ConsoleTask = (struct MsgPort *)((struct Process *)SysBase -> ThisTask) -> pr_ConsoleTask;
-
- if(InfoData = (struct InfoData *)AllocVec(sizeof(struct InfoData),MEMF_ANY|MEMF_CLEAR))
- {
- /* Send the inquiry packet to the console task. */
-
- if(DoPkt1(ConsoleTask,ACTION_DISK_INFO,MKBADDR(InfoData)))
- ConUnit = (struct ConUnit *)((struct IOStdReq *)InfoData -> id_InUse) -> io_Unit;
-
- FreeVec(InfoData);
- }
-
- return(ConUnit);
- }
-
-
- VOID
- SendAmigaDOSCommand(UBYTE *Name)
- {
- BYTE DummyBuffer[2];
- BPTR File;
-
- /* Let the asynchronous Rexx server pick up and process
- * all incoming messages rather than sending them to the
- * main process (hopefully avoids deadlock situations).
- */
-
- //BatchMode = TRUE;
-
- /* Open the console window or whatever the user
- * wants us to open here.
- */
-
- if(File = Open(WindowName,MODE_NEWFILE))
- {
- struct ConUnit *ConUnit = GetConUnit(((struct FileHandle *)BADDR(File)) -> fh_Type);
-
- if(ConUnit)
- {
- if(ConUnit -> cu_Window)
- BumpWindow(ConUnit -> cu_Window);
- }
-
- /* Make the Shell execute the command. */
-
- SystemTags(Name,SYS_Output,File,TAG_DONE);
-
- /* Wait for some impressive user action. */
-
- Write(File,LocaleString("Hello there"),51);
-
- Read(File,DummyBuffer,1);
-
- Close(File);
- }
-
- /* Bring the `term' main screen to the front and
- * fall back into asynchronous Rexx message processing.
- */
-
- //BumpWindow(Window);
-
- //BatchMode = FALSE;
- }